package com.flong.jsoup.fl;

import java.net.URL;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.flong.common.IoUtil;

public class ZfwTestText {

	
	public static void main(String[] args)throws Exception {
		
		//合同纠纷  http://china.findlaw.cn/ask/p104001_d201706_t00_page22/
		//公司法务  http://china.findlaw.cn/ask/p9_d201706_t00_page13/
		//房产土地  http://china.findlaw.cn/ask/p30_t00_page115/
		//债权债务  http://china.findlaw.cn/ask/p16_t00_page82//
		//婚姻家庭  http://china.findlaw.cn/ask/p17_t00_page202/
		//知识产权  http://china.findlaw.cn/ask/p7_d201706_t00_page11
		
		//土地纠纷 http://china.findlaw.cn/ask/p78_d201706_t00_page5/
		
		//==============刑事行政==============
		
		//行政诉讼 http://china.findlaw.cn/ask/p47_d201706_t00_page6/
		//刑事辩护  http://china.findlaw.cn/ask/p46_t00_page38/
		
		//劳动合同 http://china.findlaw.cn/ask/p67_t00_page41/
		
		//劳动工伤 http://china.findlaw.cn/ask/p23_t00_page76//
		
		//刑事辩护 http://china.findlaw.cn/ask/p46_t00_page38/
		
		//交通事故 http://china.findlaw.cn/ask/p24_t00_page178/
		//医疗纠纷  http://china.findlaw.cn/ask/p25_t00_page12/
		
		//消费维权 http://china.findlaw.cn/ask/p26_t00_page63/
		
		//其他  http://china.findlaw.cn/ask/p63_t00_page207/
		
		//公司股权  http://china.findlaw.cn/ask/p11_t00_page1/
		
		
		//公司收购 http://china.findlaw.cn/ask/p10_d201706_t00_page3/
		
		//企业改制  http://china.findlaw.cn/ask/p12_d201706_t00_page3/
		
		//移民 http://china.findlaw.cn/ask/p61_d201706_t00_page3/
		
		//仲裁  http://china.findlaw.cn/ask/p60_t00_page6/
		
		//环境保护  http://china.findlaw.cn/ask/p49_d201706_t00_page3/
		
		StringBuilder buffer =new StringBuilder();
	 	for (int i = 1; i <=3; i++) { 
	 		String url  = "http://china.findlaw.cn/ask/p49_d201706_t00_page"+i;
			Document doc = Jsoup.parse(new URL(url), 30000);
			if(doc!=null){
				Elements lis = doc.select("div[class='box_question']").select("li:gt(0)");
				for(Element li: lis){
					 String title = li.select("div[class='b_title']").select("span:eq(1)").select("a").attr("title");
					 String diqu = li.select("div[class='b_title']").select("span:eq(1)").select("em").text();
					 buffer.append(title+"="+diqu+"\n");
				}
			}
	 	}
		
	 	String string = buffer.toString();
	 	
	 	
	 	//IoUtil.Writer(string, "D://data//d.txt");
	 	System.out.println(string);
		
	}
	
}
